/*****************************************************************************
*        描述 :
*             文件描述
*        CLR版本:            3.5
*        创建者 :            蒋 光
*        个人域名:           jiangguang.net.cn
*        命名空间名称:       ECP.Model
*        文件名:             BaseFileEntity.cs
*        创建系统时间:       2012/11/2 19:07:02
*        创建年份:           2012
*
/*****************************************************************************/

namespace ECP.Model
{
    using System;
    using System.Data;
    using ECP.Utilities;

    [Serializable]
    public class BaseFileEntity
    {
        private string category;
        private string createDate;
        private string createUserID;
        private string createUserRealname;
        private string description;
        private bool enabled;
        private byte[] fileContent;
        private string fileName;
        private string filePath;
        private int fileSize;
        private string folderID;
        private string id;
        private string modifyDate;
        private string modifyUserID;
        private string modifyUserRealname;
        private int readCount;
        private string sortCode;

        public BaseFileEntity()
        {
            this.id = string.Empty;
            this.folderID = string.Empty;
            this.fileName = string.Empty;
            this.filePath = string.Empty;
            this.category = string.Empty;
            this.enabled = true;
            this.description = string.Empty;
            this.sortCode = string.Empty;
            this.createUserID = string.Empty;
            this.createUserRealname = string.Empty;
            this.createDate = string.Empty;
            this.modifyUserID = string.Empty;
            this.modifyUserRealname = string.Empty;
            this.modifyDate = string.Empty;
        }

        public BaseFileEntity(DataRow dataRow)
        {
            this.id = string.Empty;
            this.folderID = string.Empty;
            this.fileName = string.Empty;
            this.filePath = string.Empty;
            this.category = string.Empty;
            this.enabled = true;
            this.description = string.Empty;
            this.sortCode = string.Empty;
            this.createUserID = string.Empty;
            this.createUserRealname = string.Empty;
            this.createDate = string.Empty;
            this.modifyUserID = string.Empty;
            this.modifyUserRealname = string.Empty;
            this.modifyDate = string.Empty;
            this.GetFrom(dataRow);
        }

        public BaseFileEntity(DataTable dataTable)
        {
            this.id = string.Empty;
            this.folderID = string.Empty;
            this.fileName = string.Empty;
            this.filePath = string.Empty;
            this.category = string.Empty;
            this.enabled = true;
            this.description = string.Empty;
            this.sortCode = string.Empty;
            this.createUserID = string.Empty;
            this.createUserRealname = string.Empty;
            this.createDate = string.Empty;
            this.modifyUserID = string.Empty;
            this.modifyUserRealname = string.Empty;
            this.modifyDate = string.Empty;
            this.GetFrom(dataTable);
        }

        public BaseFileEntity ClearProperty()
        {
            this.ID = string.Empty;
            this.FolderID = string.Empty;
            this.FileName = string.Empty;
            this.FilePath = string.Empty;
            this.fileContent = null;
            this.FileSize = 0;
            this.ReadCount = 0;
            this.SortCode = string.Empty;
            this.Description = string.Empty;
            this.Enabled = true;
            this.CreateUserID = string.Empty;
            this.CreateUserRealname = string.Empty;
            this.CreateDate = string.Empty;
            this.ModifyUserID = string.Empty;
            this.ModifyUserRealname = string.Empty;
            this.ModifyDate = string.Empty;
            return this;
        }

        public BaseFileEntity GetFrom(DataRow dataRow)
        {
            this.ID = BaseBusinessLogic.ConvertToString(dataRow[BaseFileTable.FieldID]);
            this.FolderID = BaseBusinessLogic.ConvertToString(dataRow[BaseFileTable.FieldFolderID]);
            this.FileName = BaseBusinessLogic.ConvertToString(dataRow[BaseFileTable.FieldFileName]);
            this.ReadCount = BaseBusinessLogic.ConvertToInt(dataRow[BaseFileTable.FieldReadCount]);
            this.FilePath = BaseBusinessLogic.ConvertToString(dataRow[BaseFileTable.FieldFilePath]);
            this.Category = BaseBusinessLogic.ConvertToString(dataRow[BaseFileTable.FieldCategory]);
            this.SortCode = BaseBusinessLogic.ConvertToString(dataRow[BaseFileTable.FieldSortCode]);
            this.Description = BaseBusinessLogic.ConvertToString(dataRow[BaseFileTable.FieldDescription]);
            this.Enabled = BaseBusinessLogic.ConvertIntToBoolean(dataRow[BaseFileTable.FieldEnabled]);
            this.CreateUserID = BaseBusinessLogic.ConvertToString(dataRow[BaseFileTable.FieldCreateUserID]);
            this.CreateUserRealname = BaseBusinessLogic.ConvertToString(dataRow[BaseFileTable.FieldCreateUserRealname]);
            this.CreateDate = BaseBusinessLogic.ConvertToString(dataRow[BaseFileTable.FieldCreateDate]);
            this.ModifyUserID = BaseBusinessLogic.ConvertToString(dataRow[BaseFileTable.FieldModifyUserID]);
            this.ModifyUserRealname = BaseBusinessLogic.ConvertToString(dataRow[BaseFileTable.FieldModifyUserRealname]);
            this.ModifyDate = BaseBusinessLogic.ConvertToString(dataRow[BaseFileTable.FieldModifyDate]);
            return this;
        }

        public BaseFileEntity GetFrom(DataTable dataTable)
        {
            foreach (DataRow row in dataTable.Rows)
            {
                this.GetFrom(row);
                break;
            }
            return this;
        }

        public string Category
        {
            get
            {
                return this.category;
            }
            set
            {
                this.category = value;
            }
        }

        public string CreateDate
        {
            get
            {
                return this.createDate;
            }
            set
            {
                this.createDate = value;
            }
        }

        public string CreateUserID
        {
            get
            {
                return this.createUserID;
            }
            set
            {
                this.createUserID = value;
            }
        }

        public string CreateUserRealname
        {
            get
            {
                return this.createUserRealname;
            }
            set
            {
                this.createUserRealname = value;
            }
        }

        public string Description
        {
            get
            {
                return this.description;
            }
            set
            {
                this.description = value;
            }
        }

        public bool Enabled
        {
            get
            {
                return this.enabled;
            }
            set
            {
                this.enabled = value;
            }
        }

        public byte[] FileContent
        {
            get
            {
                return this.fileContent;
            }
            set
            {
                this.fileContent = value;
            }
        }

        public string FileName
        {
            get
            {
                return this.fileName;
            }
            set
            {
                this.fileName = value;
            }
        }

        public string FilePath
        {
            get
            {
                return this.filePath;
            }
            set
            {
                this.filePath = value;
            }
        }

        public int FileSize
        {
            get
            {
                return this.fileSize;
            }
            set
            {
                this.fileSize = value;
            }
        }

        public string FolderID
        {
            get
            {
                return this.folderID;
            }
            set
            {
                this.folderID = value;
            }
        }

        public string ID
        {
            get
            {
                return this.id;
            }
            set
            {
                this.id = value;
            }
        }

        public string ModifyDate
        {
            get
            {
                return this.modifyDate;
            }
            set
            {
                this.modifyDate = value;
            }
        }

        public string ModifyUserID
        {
            get
            {
                return this.modifyUserID;
            }
            set
            {
                this.modifyUserID = value;
            }
        }

        public string ModifyUserRealname
        {
            get
            {
                return this.modifyUserRealname;
            }
            set
            {
                this.modifyUserRealname = value;
            }
        }

        public int ReadCount
        {
            get
            {
                return this.readCount;
            }
            set
            {
                this.readCount = value;
            }
        }

        public string SortCode
        {
            get
            {
                return this.sortCode;
            }
            set
            {
                this.sortCode = value;
            }
        }
    }
}